Skip to content

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jan 14, 2025

Motivation:

The transport protocols deal in request/response part types. The bag-of-bytes message type used in [UInt8]. This means that transports might have to copy to and from the bag-of-bytes they use which is inefficient.

Modifications:

  • Add a GRPCContiguousBytes protocol defining a basic bag-of-bytes type.
  • Make the transport protocols have an associated Bytes type which conforms to GRPCContiguousBytes.
  • Propagate this requirement throughout the codebase; this affects the generated code.
  • Update the code generator to generate the appropriate code.
  • Update tests

Result:

  • Transports can use a bag-of-bytes type of their choosing.

Motivation:

The transport protocols deal in request/response part types. The
bag-of-bytes message type used in `[UInt8]`. This means that transports
might have to copy to and from the bag-of-bytes they use which is
inefficient.

Modifications:

- Add a `GRPCContiguousBytes` protocol defining a basic bag-of-bytes
  type.
- Make the transport protocols have an associated `Bytes` type which
  conforms to `GRPCContiguousBytes`.
- Propagate this requirement throughout the codebase; this affects the
  generated code.
- Update the code generator to generate the appropriate code.
- Update tests

Result:

- Transports can use a bag-of-bytes type of their choosing.
@glbrntt glbrntt merged commit 93d0536 into grpc:main Jan 17, 2025
30 of 33 checks passed
@glbrntt glbrntt deleted the v2/bag-o-bytes branch January 17, 2025 11:02
@rnro rnro mentioned this pull request Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⚠️ semver/major Breaks existing public API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants